{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import datetime\n",
    "\n",
    "import akshare as ak\n",
    "import sys\n",
    "\n",
    "import pandas as pd\n",
    "\n",
    "sys.path.append(r\"../../../\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "from python_quant.stock.MYTT_EXT import REF\n",
    "from python_quant.stock.myTT import HHV, BARSLAST, IF, CROSS\n",
    "\n",
    "trade_date = '19910101'\n",
    "now_date = datetime.datetime.now().strftime('%Y%m%d')\n",
    "stock_zh_a_hist_df = ak.stock_zh_a_hist(symbol='002717', period=\"daily\", start_date=trade_date, end_date='20230321', adjust=\"qfq\")\n",
    "   # 取收盘价序列\n",
    "C = stock_zh_a_hist_df['收盘'].values\n",
    "\n",
    "# 取开盘价序列\n",
    "O = stock_zh_a_hist_df['开盘'].values\n",
    "\n",
    "# 取最高价序列\n",
    "H = stock_zh_a_hist_df['最高'].values\n",
    "\n",
    "# 取最低价序列\n",
    "L = stock_zh_a_hist_df['最低'].values\n",
    "\n",
    "X = HHV(H, 5)\n",
    "X = np.nan_to_num(X, nan=-1)\n",
    "V = REF(X, 1)\n",
    "V = np.nan_to_num(V, nan=-1)\n",
    "VAR111 = C > V\n",
    "VAR222 = BARSLAST(VAR111)\n",
    "D = REF(L, 1)\n",
    "D = np.nan_to_num(D, nan=-1)\n",
    "B = IF(C > L, L, D)\n",
    "A = REF(B, VAR222)\n",
    "G = IF(D > L, L, D)\n",
    "OUTLINE = IF(VAR111, G, A)\n",
    "S = CROSS(OUTLINE, C)\n",
    "B = CROSS(C, OUTLINE)\n",
    "\n",
    "B"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "获取次日上涨概率"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "千股千评"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "stock = ak.stock_comment_em()\n",
    "stock = stock[(stock['上升']>0) & (stock['涨跌幅']<0) & (stock['上升']>=100)& (stock['综合得分']>=70) & (stock['最新价']<stock['主力成本']) & (stock['关注指数']>=70) & ~(stock['代码'].str.startswith('688'))]\n",
    "stock"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "outputs": [
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[1;31mFileNotFoundError\u001B[0m                         Traceback (most recent call last)",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\site-packages\\selenium\\webdriver\\common\\service.py:195\u001B[0m, in \u001B[0;36mService._start_process\u001B[1;34m(self, path)\u001B[0m\n\u001B[0;32m    194\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m--> 195\u001B[0m     \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mprocess \u001B[38;5;241m=\u001B[39m \u001B[43msubprocess\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mPopen\u001B[49m\u001B[43m(\u001B[49m\n\u001B[0;32m    196\u001B[0m \u001B[43m        \u001B[49m\u001B[43mcmd\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    197\u001B[0m \u001B[43m        \u001B[49m\u001B[43menv\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43menv\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    198\u001B[0m \u001B[43m        \u001B[49m\u001B[43mclose_fds\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43msystem\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m!=\u001B[39;49m\u001B[43m \u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mWindows\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m,\u001B[49m\n\u001B[0;32m    199\u001B[0m \u001B[43m        \u001B[49m\u001B[43mstdout\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mlog_file\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    200\u001B[0m \u001B[43m        \u001B[49m\u001B[43mstderr\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mlog_file\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    201\u001B[0m \u001B[43m        \u001B[49m\u001B[43mstdin\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mPIPE\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    202\u001B[0m \u001B[43m        \u001B[49m\u001B[43mcreationflags\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mcreation_flags\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    203\u001B[0m \u001B[43m    \u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m    204\u001B[0m     logger\u001B[38;5;241m.\u001B[39mdebug(\u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mStarted executable: `\u001B[39m\u001B[38;5;132;01m{\u001B[39;00m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mpath\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m` in a child process with pid: \u001B[39m\u001B[38;5;132;01m{\u001B[39;00m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mprocess\u001B[38;5;241m.\u001B[39mpid\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m)\n",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\subprocess.py:858\u001B[0m, in \u001B[0;36mPopen.__init__\u001B[1;34m(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)\u001B[0m\n\u001B[0;32m    855\u001B[0m             \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mstderr \u001B[38;5;241m=\u001B[39m io\u001B[38;5;241m.\u001B[39mTextIOWrapper(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mstderr,\n\u001B[0;32m    856\u001B[0m                     encoding\u001B[38;5;241m=\u001B[39mencoding, errors\u001B[38;5;241m=\u001B[39merrors)\n\u001B[1;32m--> 858\u001B[0m     \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_execute_child\u001B[49m\u001B[43m(\u001B[49m\u001B[43margs\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mexecutable\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mpreexec_fn\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mclose_fds\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    859\u001B[0m \u001B[43m                        \u001B[49m\u001B[43mpass_fds\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcwd\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43menv\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    860\u001B[0m \u001B[43m                        \u001B[49m\u001B[43mstartupinfo\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mcreationflags\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mshell\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    861\u001B[0m \u001B[43m                        \u001B[49m\u001B[43mp2cread\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mp2cwrite\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    862\u001B[0m \u001B[43m                        \u001B[49m\u001B[43mc2pread\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mc2pwrite\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    863\u001B[0m \u001B[43m                        \u001B[49m\u001B[43merrread\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43merrwrite\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m    864\u001B[0m \u001B[43m                        \u001B[49m\u001B[43mrestore_signals\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstart_new_session\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m    865\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m:\n\u001B[0;32m    866\u001B[0m     \u001B[38;5;66;03m# Cleanup if the child failed starting.\u001B[39;00m\n",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\subprocess.py:1311\u001B[0m, in \u001B[0;36mPopen._execute_child\u001B[1;34m(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)\u001B[0m\n\u001B[0;32m   1310\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m-> 1311\u001B[0m     hp, ht, pid, tid \u001B[38;5;241m=\u001B[39m \u001B[43m_winapi\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mCreateProcess\u001B[49m\u001B[43m(\u001B[49m\u001B[43mexecutable\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43margs\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m   1312\u001B[0m \u001B[43m                             \u001B[49m\u001B[38;5;66;43;03m# no special security\u001B[39;49;00m\n\u001B[0;32m   1313\u001B[0m \u001B[43m                             \u001B[49m\u001B[38;5;28;43;01mNone\u001B[39;49;00m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;28;43;01mNone\u001B[39;49;00m\u001B[43m,\u001B[49m\n\u001B[0;32m   1314\u001B[0m \u001B[43m                             \u001B[49m\u001B[38;5;28;43mint\u001B[39;49m\u001B[43m(\u001B[49m\u001B[38;5;129;43;01mnot\u001B[39;49;00m\u001B[43m \u001B[49m\u001B[43mclose_fds\u001B[49m\u001B[43m)\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m   1315\u001B[0m \u001B[43m                             \u001B[49m\u001B[43mcreationflags\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m   1316\u001B[0m \u001B[43m                             \u001B[49m\u001B[43menv\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m   1317\u001B[0m \u001B[43m                             \u001B[49m\u001B[43mcwd\u001B[49m\u001B[43m,\u001B[49m\n\u001B[0;32m   1318\u001B[0m \u001B[43m                             \u001B[49m\u001B[43mstartupinfo\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m   1319\u001B[0m \u001B[38;5;28;01mfinally\u001B[39;00m:\n\u001B[0;32m   1320\u001B[0m     \u001B[38;5;66;03m# Child is launched. Close the parent's copy of those pipe\u001B[39;00m\n\u001B[0;32m   1321\u001B[0m     \u001B[38;5;66;03m# handles that only the child should have open.  You need\u001B[39;00m\n\u001B[1;32m   (...)\u001B[0m\n\u001B[0;32m   1324\u001B[0m     \u001B[38;5;66;03m# pipe will not close when the child process exits and the\u001B[39;00m\n\u001B[0;32m   1325\u001B[0m     \u001B[38;5;66;03m# ReadFile will hang.\u001B[39;00m\n",
      "\u001B[1;31mFileNotFoundError\u001B[0m: [WinError 2] 系统找不到指定的文件。",
      "\nDuring handling of the above exception, another exception occurred:\n",
      "\u001B[1;31mWebDriverException\u001B[0m                        Traceback (most recent call last)",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\site-packages\\selenium\\webdriver\\common\\service.py:88\u001B[0m, in \u001B[0;36mService.start\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m     87\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m---> 88\u001B[0m     \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_start_process\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mpath\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m     89\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m WebDriverException \u001B[38;5;28;01mas\u001B[39;00m err:\n",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\site-packages\\selenium\\webdriver\\common\\service.py:209\u001B[0m, in \u001B[0;36mService._start_process\u001B[1;34m(self, path)\u001B[0m\n\u001B[0;32m    208\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m err\u001B[38;5;241m.\u001B[39merrno \u001B[38;5;241m==\u001B[39m errno\u001B[38;5;241m.\u001B[39mENOENT:\n\u001B[1;32m--> 209\u001B[0m     \u001B[38;5;28;01mraise\u001B[39;00m WebDriverException(\n\u001B[0;32m    210\u001B[0m         \u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;132;01m{\u001B[39;00mos\u001B[38;5;241m.\u001B[39mpath\u001B[38;5;241m.\u001B[39mbasename(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mpath)\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124m executable needs to be in PATH. \u001B[39m\u001B[38;5;132;01m{\u001B[39;00m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mstart_error_message\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m\n\u001B[0;32m    211\u001B[0m     )\n\u001B[0;32m    212\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m err\u001B[38;5;241m.\u001B[39merrno \u001B[38;5;241m==\u001B[39m errno\u001B[38;5;241m.\u001B[39mEACCES:\n",
      "\u001B[1;31mWebDriverException\u001B[0m: Message: 'geckodriver' executable needs to be in PATH. \n",
      "\nDuring handling of the above exception, another exception occurred:\n",
      "\u001B[1;31mKeyboardInterrupt\u001B[0m                         Traceback (most recent call last)",
      "Cell \u001B[1;32mIn[11], line 4\u001B[0m\n\u001B[0;32m      2\u001B[0m option \u001B[38;5;241m=\u001B[39m webdriver\u001B[38;5;241m.\u001B[39mFirefoxOptions\n\u001B[0;32m      3\u001B[0m option\u001B[38;5;241m.\u001B[39mbinary_location \u001B[38;5;241m=\u001B[39m \u001B[38;5;124mr\u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mC:\u001B[39m\u001B[38;5;124m\\\u001B[39m\u001B[38;5;124mProgram Files\u001B[39m\u001B[38;5;124m\\\u001B[39m\u001B[38;5;124mMozilla Firefox\u001B[39m\u001B[38;5;124m\\\u001B[39m\u001B[38;5;124mfirefox.exe\u001B[39m\u001B[38;5;124m'\u001B[39m\n\u001B[1;32m----> 4\u001B[0m browser \u001B[38;5;241m=\u001B[39m webdriver\u001B[38;5;241m.\u001B[39mbrowser \u001B[38;5;241m=\u001B[39m webdriver\u001B[38;5;241m.\u001B[39mbrowser \u001B[38;5;241m=\u001B[39m webdriver\u001B[38;5;241m.\u001B[39mbrowser \u001B[38;5;241m=\u001B[39m \u001B[43mwebdriver\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mFirefox\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m      5\u001B[0m browser\u001B[38;5;241m.\u001B[39mget(\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mhttps://data.eastmoney.com/stock/yybph.html\u001B[39m\u001B[38;5;124m'\u001B[39m)  \u001B[38;5;66;03m# 通过get(url)\u001B[39;00m\n\u001B[0;32m      6\u001B[0m \u001B[38;5;28mprint\u001B[39m(browser\u001B[38;5;241m.\u001B[39mpage_source)\n",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\site-packages\\selenium\\webdriver\\firefox\\webdriver.py:191\u001B[0m, in \u001B[0;36mWebDriver.__init__\u001B[1;34m(self, firefox_profile, firefox_binary, capabilities, proxy, executable_path, options, service_log_path, service_args, service, desired_capabilities, log_path, keep_alive)\u001B[0m\n\u001B[0;32m    189\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mservice:\n\u001B[0;32m    190\u001B[0m     \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mservice \u001B[38;5;241m=\u001B[39m Service(executable_path, service_args\u001B[38;5;241m=\u001B[39mservice_args, log_path\u001B[38;5;241m=\u001B[39mservice_log_path)\n\u001B[1;32m--> 191\u001B[0m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mservice\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mstart\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m    193\u001B[0m executor \u001B[38;5;241m=\u001B[39m FirefoxRemoteConnection(\n\u001B[0;32m    194\u001B[0m     remote_server_addr\u001B[38;5;241m=\u001B[39m\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mservice\u001B[38;5;241m.\u001B[39mservice_url, ignore_proxy\u001B[38;5;241m=\u001B[39moptions\u001B[38;5;241m.\u001B[39m_ignore_local_proxy\n\u001B[0;32m    195\u001B[0m )\n\u001B[0;32m    196\u001B[0m \u001B[38;5;28msuper\u001B[39m()\u001B[38;5;241m.\u001B[39m\u001B[38;5;21m__init__\u001B[39m(command_executor\u001B[38;5;241m=\u001B[39mexecutor, options\u001B[38;5;241m=\u001B[39moptions, keep_alive\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mTrue\u001B[39;00m)\n",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\site-packages\\selenium\\webdriver\\common\\service.py:95\u001B[0m, in \u001B[0;36mService.start\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m     92\u001B[0m browser \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;18m__class__\u001B[39m\u001B[38;5;241m.\u001B[39m\u001B[38;5;18m__module__\u001B[39m\u001B[38;5;241m.\u001B[39msplit(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m.\u001B[39m\u001B[38;5;124m\"\u001B[39m)[\u001B[38;5;241m-\u001B[39m\u001B[38;5;241m2\u001B[39m]\n\u001B[0;32m     94\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m---> 95\u001B[0m     path \u001B[38;5;241m=\u001B[39m \u001B[43mSeleniumManager\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mdriver_location\u001B[49m\u001B[43m(\u001B[49m\u001B[43mbrowser\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m     96\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m WebDriverException \u001B[38;5;28;01mas\u001B[39;00m new_err:\n\u001B[0;32m     97\u001B[0m     logger\u001B[38;5;241m.\u001B[39mdebug(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mUnable to obtain driver using Selenium Manager: \u001B[39m\u001B[38;5;124m\"\u001B[39m \u001B[38;5;241m+\u001B[39m new_err\u001B[38;5;241m.\u001B[39mmsg)\n",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\site-packages\\selenium\\webdriver\\common\\selenium_manager.py:74\u001B[0m, in \u001B[0;36mSeleniumManager.driver_location\u001B[1;34m(self, browser)\u001B[0m\n\u001B[0;32m     71\u001B[0m     browser \u001B[38;5;241m=\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124miexplorer\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[0;32m     73\u001B[0m binary, flag, browser \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mstr\u001B[39m(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mget_binary()), \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m--browser\u001B[39m\u001B[38;5;124m\"\u001B[39m, browser\n\u001B[1;32m---> 74\u001B[0m result \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mrun\u001B[49m\u001B[43m(\u001B[49m\u001B[43m(\u001B[49m\u001B[43mbinary\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mflag\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mbrowser\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m     75\u001B[0m executable \u001B[38;5;241m=\u001B[39m result\u001B[38;5;241m.\u001B[39msplit(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;130;01m\\t\u001B[39;00m\u001B[38;5;124m\"\u001B[39m)[\u001B[38;5;241m-\u001B[39m\u001B[38;5;241m1\u001B[39m]\u001B[38;5;241m.\u001B[39mstrip()\n\u001B[0;32m     76\u001B[0m logger\u001B[38;5;241m.\u001B[39mdebug(\u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mUsing driver at: \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mexecutable\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m)\n",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\site-packages\\selenium\\webdriver\\common\\selenium_manager.py:89\u001B[0m, in \u001B[0;36mSeleniumManager.run\u001B[1;34m(args)\u001B[0m\n\u001B[0;32m     87\u001B[0m command \u001B[38;5;241m=\u001B[39m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m \u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;241m.\u001B[39mjoin(args)\n\u001B[0;32m     88\u001B[0m logger\u001B[38;5;241m.\u001B[39mdebug(\u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mExecuting: \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mcommand\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m)\n\u001B[1;32m---> 89\u001B[0m completed_proc \u001B[38;5;241m=\u001B[39m \u001B[43msubprocess\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mrun\u001B[49m\u001B[43m(\u001B[49m\u001B[43margs\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstdout\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43msubprocess\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mPIPE\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstderr\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43msubprocess\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mPIPE\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m     90\u001B[0m stdout \u001B[38;5;241m=\u001B[39m completed_proc\u001B[38;5;241m.\u001B[39mstdout\u001B[38;5;241m.\u001B[39mdecode(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mutf-8\u001B[39m\u001B[38;5;124m\"\u001B[39m)\u001B[38;5;241m.\u001B[39mrstrip(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;130;01m\\n\u001B[39;00m\u001B[38;5;124m\"\u001B[39m)\n\u001B[0;32m     91\u001B[0m stderr \u001B[38;5;241m=\u001B[39m completed_proc\u001B[38;5;241m.\u001B[39mstderr\u001B[38;5;241m.\u001B[39mdecode(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mutf-8\u001B[39m\u001B[38;5;124m\"\u001B[39m)\u001B[38;5;241m.\u001B[39mrstrip(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;130;01m\\n\u001B[39;00m\u001B[38;5;124m\"\u001B[39m)\n",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\subprocess.py:495\u001B[0m, in \u001B[0;36mrun\u001B[1;34m(input, capture_output, timeout, check, *popenargs, **kwargs)\u001B[0m\n\u001B[0;32m    493\u001B[0m \u001B[38;5;28;01mwith\u001B[39;00m Popen(\u001B[38;5;241m*\u001B[39mpopenargs, \u001B[38;5;241m*\u001B[39m\u001B[38;5;241m*\u001B[39mkwargs) \u001B[38;5;28;01mas\u001B[39;00m process:\n\u001B[0;32m    494\u001B[0m     \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m--> 495\u001B[0m         stdout, stderr \u001B[38;5;241m=\u001B[39m \u001B[43mprocess\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mcommunicate\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43minput\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mtimeout\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mtimeout\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m    496\u001B[0m     \u001B[38;5;28;01mexcept\u001B[39;00m TimeoutExpired \u001B[38;5;28;01mas\u001B[39;00m exc:\n\u001B[0;32m    497\u001B[0m         process\u001B[38;5;241m.\u001B[39mkill()\n",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\subprocess.py:1028\u001B[0m, in \u001B[0;36mPopen.communicate\u001B[1;34m(self, input, timeout)\u001B[0m\n\u001B[0;32m   1025\u001B[0m     endtime \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;01mNone\u001B[39;00m\n\u001B[0;32m   1027\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[1;32m-> 1028\u001B[0m     stdout, stderr \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_communicate\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43minput\u001B[39;49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mendtime\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mtimeout\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m   1029\u001B[0m \u001B[38;5;28;01mexcept\u001B[39;00m \u001B[38;5;167;01mKeyboardInterrupt\u001B[39;00m:\n\u001B[0;32m   1030\u001B[0m     \u001B[38;5;66;03m# https://bugs.python.org/issue25942\u001B[39;00m\n\u001B[0;32m   1031\u001B[0m     \u001B[38;5;66;03m# See the detailed comment in .wait().\u001B[39;00m\n\u001B[0;32m   1032\u001B[0m     \u001B[38;5;28;01mif\u001B[39;00m timeout \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\subprocess.py:1399\u001B[0m, in \u001B[0;36mPopen._communicate\u001B[1;34m(self, input, endtime, orig_timeout)\u001B[0m\n\u001B[0;32m   1395\u001B[0m \u001B[38;5;66;03m# Wait for the reader threads, or time out.  If we time out, the\u001B[39;00m\n\u001B[0;32m   1396\u001B[0m \u001B[38;5;66;03m# threads remain reading and the fds left open in case the user\u001B[39;00m\n\u001B[0;32m   1397\u001B[0m \u001B[38;5;66;03m# calls communicate again.\u001B[39;00m\n\u001B[0;32m   1398\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mstdout \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[1;32m-> 1399\u001B[0m     \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mstdout_thread\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mjoin\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_remaining_time\u001B[49m\u001B[43m(\u001B[49m\u001B[43mendtime\u001B[49m\u001B[43m)\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m   1400\u001B[0m     \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mstdout_thread\u001B[38;5;241m.\u001B[39mis_alive():\n\u001B[0;32m   1401\u001B[0m         \u001B[38;5;28;01mraise\u001B[39;00m TimeoutExpired(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39margs, orig_timeout)\n",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\threading.py:1011\u001B[0m, in \u001B[0;36mThread.join\u001B[1;34m(self, timeout)\u001B[0m\n\u001B[0;32m   1008\u001B[0m     \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mRuntimeError\u001B[39;00m(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mcannot join current thread\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n\u001B[0;32m   1010\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m timeout \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[1;32m-> 1011\u001B[0m     \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_wait_for_tstate_lock\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m   1012\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[0;32m   1013\u001B[0m     \u001B[38;5;66;03m# the behavior of a negative timeout isn't documented, but\u001B[39;00m\n\u001B[0;32m   1014\u001B[0m     \u001B[38;5;66;03m# historically .join(timeout=x) for x<0 has acted as if timeout=0\u001B[39;00m\n\u001B[0;32m   1015\u001B[0m     \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_wait_for_tstate_lock(timeout\u001B[38;5;241m=\u001B[39m\u001B[38;5;28mmax\u001B[39m(timeout, \u001B[38;5;241m0\u001B[39m))\n",
      "File \u001B[1;32mC:\\mySpace\\mysoftware\\anaconda\\envs\\jue_jin\\lib\\threading.py:1027\u001B[0m, in \u001B[0;36mThread._wait_for_tstate_lock\u001B[1;34m(self, block, timeout)\u001B[0m\n\u001B[0;32m   1025\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m lock \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:  \u001B[38;5;66;03m# already determined that the C code is done\u001B[39;00m\n\u001B[0;32m   1026\u001B[0m     \u001B[38;5;28;01massert\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_is_stopped\n\u001B[1;32m-> 1027\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m \u001B[43mlock\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43macquire\u001B[49m\u001B[43m(\u001B[49m\u001B[43mblock\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mtimeout\u001B[49m\u001B[43m)\u001B[49m:\n\u001B[0;32m   1028\u001B[0m     lock\u001B[38;5;241m.\u001B[39mrelease()\n\u001B[0;32m   1029\u001B[0m     \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_stop()\n",
      "\u001B[1;31mKeyboardInterrupt\u001B[0m: "
     ]
    }
   ],
   "source": [
    "from selenium import webdriver\n",
    "option = webdriver.FirefoxOptions\n",
    "option.binary_location = r'C:\\Program Files\\Mozilla Firefox\\firefox.exe'\n",
    "browser = webdriver.browser = webdriver.browser = webdriver.browser = webdriver.Firefox()\n",
    "browser.get('https://data.eastmoney.com/stock/yybph.html')  # 通过get(url)\n",
    "print(browser.page_source)\n",
    "browser.close()"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "龙虎榜营业部概率统计"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "stock_dzjy_yybph_df = ak.stock_dzjy_yybph(symbol='近一年')\n",
    "stock_dzjy_yybph_df"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "机构调研"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "from akshare import stock_jgdy_tj_em\n",
    "\n",
    "infos = stock_jgdy_tj_em(\"20230212\")\n",
    "infos = infos[(infos['接待机构数量']>50)]\n",
    "infos"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "机构净买入"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "stock_lhb_jgmmtj_em_df = ak.stock_lhb_jgmmtj_em(start_date=\"20230212\", end_date=\"20230317\")\n",
    "stock_lhb_jgmmtj_em_df = stock_lhb_jgmmtj_em_df[(stock_lhb_jgmmtj_em_df['卖方机构数']==0) & (stock_lhb_jgmmtj_em_df['机构卖出总额']==0)]\n",
    "stock_lhb_jgmmtj_em_df"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "上龙虎榜 并且机构调研"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "intersected_df = pd.merge(stock_lhb_jgmmtj_em_df, infos, on=['代码'], how='inner')\n",
    "intersected_df"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "chatGpt"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "import asyncio\n",
    "from EdgeGPT import Chatbot, ConversationStyle\n",
    "\n",
    "bot = Chatbot(cookiePath='./cookie.json')"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "outputs": [
    {
     "data": {
      "text/plain": "        序号      代码    名称    最新价  涨跌幅   涨跌额       成交量          成交额    振幅  \\\n2633  2634  601500  通用股份   3.98 -1.0 -0.04   66548.0   26497838.0  1.99   \n2634  2635  600237  铜峰电子   6.96 -1.0 -0.07  133666.0   93154967.0  2.13   \n2636  2637  600736  苏州高新   4.97 -1.0 -0.05   94166.0   46908132.0  1.59   \n2637  2638  002087  新野纺织   2.98 -1.0 -0.03   93793.0   27968463.5  1.66   \n2639  2640  603797  联泰环保   5.95 -1.0 -0.06   36699.0   21832116.0  1.50   \n2641  2642  603077  和邦生物   2.97 -1.0 -0.03  491084.0  145824632.0  1.00   \n2642  2643  000908  景峰医药   2.97 -1.0 -0.03   83907.0   24929074.0  2.00   \n2643  2644  605338  巴比食品  30.66 -1.0 -0.31   13159.0   40225145.0  2.65   \n\n         最高  ...    量比   换手率  市盈率-动态   市净率           总市值          流通市值    涨速  \\\n2633   4.04  ...  1.16  0.52  206.69  1.21  6.292870e+09  5.111641e+09  0.25   \n2634   7.05  ...  1.14  2.37   53.12  3.21  3.928012e+09  3.928012e+09  0.14   \n2636   5.03  ...  1.14  0.82   21.92  0.79  5.721926e+09  5.721926e+09  0.00   \n2637   3.01  ...  1.14  1.15  -15.91  0.58  2.434047e+09  2.430603e+09  0.34   \n2639   6.01  ...  1.09  0.63   12.08  1.28  3.475503e+09  3.475503e+09  0.51   \n2641   2.99  ...  1.06  0.56    6.89  1.37  2.622881e+10  2.622881e+10  0.00   \n2642   3.01  ...  1.05  1.07  -65.86  9.44  2.612930e+09  2.322472e+09  0.34   \n2643  31.13  ...  1.53  1.53   34.51  3.65  7.668488e+09  2.644845e+09  0.20   \n\n      5分钟涨跌  60日涨跌幅  年初至今涨跌幅  \n2633   0.25    6.70     7.57  \n2634   0.14    3.26     9.43  \n2636   0.00    4.85     6.20  \n2637   0.00   -6.29    -5.40  \n2639   0.34    5.87     7.79  \n2641   0.00   -2.94    -2.30  \n2642   0.00   -9.17    -6.60  \n2643  -0.23   -0.23    -3.37  \n\n[8 rows x 23 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>序号</th>\n      <th>代码</th>\n      <th>名称</th>\n      <th>最新价</th>\n      <th>涨跌幅</th>\n      <th>涨跌额</th>\n      <th>成交量</th>\n      <th>成交额</th>\n      <th>振幅</th>\n      <th>最高</th>\n      <th>...</th>\n      <th>量比</th>\n      <th>换手率</th>\n      <th>市盈率-动态</th>\n      <th>市净率</th>\n      <th>总市值</th>\n      <th>流通市值</th>\n      <th>涨速</th>\n      <th>5分钟涨跌</th>\n      <th>60日涨跌幅</th>\n      <th>年初至今涨跌幅</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>2633</th>\n      <td>2634</td>\n      <td>601500</td>\n      <td>通用股份</td>\n      <td>3.98</td>\n      <td>-1.0</td>\n      <td>-0.04</td>\n      <td>66548.0</td>\n      <td>26497838.0</td>\n      <td>1.99</td>\n      <td>4.04</td>\n      <td>...</td>\n      <td>1.16</td>\n      <td>0.52</td>\n      <td>206.69</td>\n      <td>1.21</td>\n      <td>6.292870e+09</td>\n      <td>5.111641e+09</td>\n      <td>0.25</td>\n      <td>0.25</td>\n      <td>6.70</td>\n      <td>7.57</td>\n    </tr>\n    <tr>\n      <th>2634</th>\n      <td>2635</td>\n      <td>600237</td>\n      <td>铜峰电子</td>\n      <td>6.96</td>\n      <td>-1.0</td>\n      <td>-0.07</td>\n      <td>133666.0</td>\n      <td>93154967.0</td>\n      <td>2.13</td>\n      <td>7.05</td>\n      <td>...</td>\n      <td>1.14</td>\n      <td>2.37</td>\n      <td>53.12</td>\n      <td>3.21</td>\n      <td>3.928012e+09</td>\n      <td>3.928012e+09</td>\n      <td>0.14</td>\n      <td>0.14</td>\n      <td>3.26</td>\n      <td>9.43</td>\n    </tr>\n    <tr>\n      <th>2636</th>\n      <td>2637</td>\n      <td>600736</td>\n      <td>苏州高新</td>\n      <td>4.97</td>\n      <td>-1.0</td>\n      <td>-0.05</td>\n      <td>94166.0</td>\n      <td>46908132.0</td>\n      <td>1.59</td>\n      <td>5.03</td>\n      <td>...</td>\n      <td>1.14</td>\n      <td>0.82</td>\n      <td>21.92</td>\n      <td>0.79</td>\n      <td>5.721926e+09</td>\n      <td>5.721926e+09</td>\n      <td>0.00</td>\n      <td>0.00</td>\n      <td>4.85</td>\n      <td>6.20</td>\n    </tr>\n    <tr>\n      <th>2637</th>\n      <td>2638</td>\n      <td>002087</td>\n      <td>新野纺织</td>\n      <td>2.98</td>\n      <td>-1.0</td>\n      <td>-0.03</td>\n      <td>93793.0</td>\n      <td>27968463.5</td>\n      <td>1.66</td>\n      <td>3.01</td>\n      <td>...</td>\n      <td>1.14</td>\n      <td>1.15</td>\n      <td>-15.91</td>\n      <td>0.58</td>\n      <td>2.434047e+09</td>\n      <td>2.430603e+09</td>\n      <td>0.34</td>\n      <td>0.00</td>\n      <td>-6.29</td>\n      <td>-5.40</td>\n    </tr>\n    <tr>\n      <th>2639</th>\n      <td>2640</td>\n      <td>603797</td>\n      <td>联泰环保</td>\n      <td>5.95</td>\n      <td>-1.0</td>\n      <td>-0.06</td>\n      <td>36699.0</td>\n      <td>21832116.0</td>\n      <td>1.50</td>\n      <td>6.01</td>\n      <td>...</td>\n      <td>1.09</td>\n      <td>0.63</td>\n      <td>12.08</td>\n      <td>1.28</td>\n      <td>3.475503e+09</td>\n      <td>3.475503e+09</td>\n      <td>0.51</td>\n      <td>0.34</td>\n      <td>5.87</td>\n      <td>7.79</td>\n    </tr>\n    <tr>\n      <th>2641</th>\n      <td>2642</td>\n      <td>603077</td>\n      <td>和邦生物</td>\n      <td>2.97</td>\n      <td>-1.0</td>\n      <td>-0.03</td>\n      <td>491084.0</td>\n      <td>145824632.0</td>\n      <td>1.00</td>\n      <td>2.99</td>\n      <td>...</td>\n      <td>1.06</td>\n      <td>0.56</td>\n      <td>6.89</td>\n      <td>1.37</td>\n      <td>2.622881e+10</td>\n      <td>2.622881e+10</td>\n      <td>0.00</td>\n      <td>0.00</td>\n      <td>-2.94</td>\n      <td>-2.30</td>\n    </tr>\n    <tr>\n      <th>2642</th>\n      <td>2643</td>\n      <td>000908</td>\n      <td>景峰医药</td>\n      <td>2.97</td>\n      <td>-1.0</td>\n      <td>-0.03</td>\n      <td>83907.0</td>\n      <td>24929074.0</td>\n      <td>2.00</td>\n      <td>3.01</td>\n      <td>...</td>\n      <td>1.05</td>\n      <td>1.07</td>\n      <td>-65.86</td>\n      <td>9.44</td>\n      <td>2.612930e+09</td>\n      <td>2.322472e+09</td>\n      <td>0.34</td>\n      <td>0.00</td>\n      <td>-9.17</td>\n      <td>-6.60</td>\n    </tr>\n    <tr>\n      <th>2643</th>\n      <td>2644</td>\n      <td>605338</td>\n      <td>巴比食品</td>\n      <td>30.66</td>\n      <td>-1.0</td>\n      <td>-0.31</td>\n      <td>13159.0</td>\n      <td>40225145.0</td>\n      <td>2.65</td>\n      <td>31.13</td>\n      <td>...</td>\n      <td>1.53</td>\n      <td>1.53</td>\n      <td>34.51</td>\n      <td>3.65</td>\n      <td>7.668488e+09</td>\n      <td>2.644845e+09</td>\n      <td>0.20</td>\n      <td>-0.23</td>\n      <td>-0.23</td>\n      <td>-3.37</td>\n    </tr>\n  </tbody>\n</table>\n<p>8 rows × 23 columns</p>\n</div>"
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import akshare as ak\n",
    "stock_pool = ak.stock_zh_a_spot_em()\n",
    "stock_pool = stock_pool[((stock_pool['代码'].str.startswith('60')) | (stock_pool['代码'].str.startswith('30')) | (stock_pool['代码'].str.startswith('00'))) & (~stock_pool['名称'].str.contains('ST')) & (stock_pool['涨跌幅']==-1) & (stock_pool['量比']>=1)]\n",
    "stock_pool = stock_pool.dropna()\n",
    "stock_pool"
   ],
   "metadata": {
    "collapsed": false
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
